package com.smart.order.listener;

import com.smart.order.constants.OrderConstants;
import com.smart.order.service.OrderService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author Administrator
 */

@Component
@RocketMQMessageListener(consumerGroup = OrderConstants.OrderConsumerGroup.ORDER_CONSUMER_GROUP, topic = OrderConstants.OrderTopic.ORDER_CANCEL_TOPIC)
public class OrderCancelListener implements RocketMQListener<String> {
    @Resource
    private OrderService orderService;

    @Override
    public void onMessage(String orderSn) {
        orderService.cannelOrder(orderSn);
    }
}
